#include <bits/stdc++.h>
// 2025/01/22
// tag: 
// Author: Zhang Muen
using namespace std;

int n, m;
int num[1000001];

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        cin >> num[i];
    for (int i = 1; i <= m; i++){
        int target;
        cin >> target;
        int l = 1, r = n;
        while (l <= r){
            int mid = (l + r) / 2;
            if (num[mid] <= target)
                l = mid + 1;
            else
                r = mid - 1;
        }
        cout << (l <= n ? num[l] : -1) << " ";
    }
    return 0;
}